Open and Run a Test from a Specific Baseline in an ALM Library
Source code
'************************************************************************************************************************
'Description:
'
'This example opens a business component from a specific ALM baseline, sets the run options to store the results in a local drive,
'runs the test, and then checks the results of the test run.
'
'Assumptions:
'There is no unsaved test currently open in UFT One.
'When UFT One opens, it loads the add-ins required for the test.
'************************************************************************************************************************

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable
Dim qtResultsOpt 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start UFT One
qtApp.Visible = True ' Make the UFT One application visible

' Set UFT One run options
qtApp.Options.Run.ImageCaptureForTestResults = "OnError"

qtApp.Options.Run.RunMode = "Fast"
qtApp.Options.Run.ViewResults = False

' Open the test version stored in the MyApp_Version2.0_Tests baseline.
qtApp.OpenTestFromBaseline "[QualityCenter] Subject\MyApp\MyTest", "Libraries\MyLibFolder\LibName", "MyApp_Version2.0_Tests"

' set run settings for the test
Set qtTest = qtApp.Test
qtTest.Settings.Run.OnError = "NextStep" ' Instruct UFT One to perform next step when error occurs
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
qtResultsOpt.ResultsLocation = "C:\Tests\Test1\Res1" ' Set the results location

qtTest.Run qtResultsOpt ' Run the test

MsgBox qtTest.LastRunResults.Status ' Check the results of the test run
qtTest.Close ' Close the test

Set qtResultsOpt = Nothing ' Release the Run Results Options object
Set qtTest = Nothing ' Release the Test object
Set qtApp = Nothing ' Release the Application object